package com.maolong.framework.repository;

import com.maolong.framework.domain.Goods;
import com.maolong.framework.domain.Product;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GoodsDao extends ElasticsearchRepository<Goods,Long> {
    /**
     * 扩展的api功能
     * findByTitle，那么它就知道你是根据title查询，然后自动帮你完成，无需写实现类
     */
    Goods findByTitle(String title);

    Goods findByTitleAndPrice(String title,Double price);

    List<Goods> findAllByTitleOrPrice(String title,Double price);

    List<Goods> findAllByTitleLike(String title);

    List<Goods> findAllByPriceLessThan(Double price);

    List<Goods> findAllByPriceIn(List<Double> price);

    List<Goods> findAllByPriceBetween(Double price1,Double price2);

    List<Goods> findAllByTitleOrderByCategoryNameDesc(String title);

    List<Goods> findAllByTitleLike(String title, Pageable pageable);



}
